Skip to content

タイムスケールと半径の編集を追加#13

Open
shirokuma222 wants to merge 4 commits intomainfrom
feature/parameters
Open

タイムスケールと半径の編集を追加#13
shirokuma222 wants to merge 4 commits intomainfrom
feature/parameters

Conversation

@shirokuma222
Copy link
Contributor

timeScaleを実装したが、惑星の移動はcannon.jsが管理しているっぽいので時間を移動に反映させるのは難しかった。(現在の速度をtimeScale倍してごまかしてもいいかも)
timeScaleで変わるのは現在は自転速度と爆発のモーションくらい

Copy link
Contributor

@tknkaa tknkaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

プルリクエストのコメントにもあるように、惑星の移動速度も timeScale に合わせてスケールさせるのがいいかと思います。


// 誤差による自転速度の異常上昇を防ぐ
api.angularVelocity.set(0, planet.rotationSpeedY, 0);
api.angularVelocity.set(0, planet.rotationSpeedY * timeScale, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここは毎回 API を叩くと物理エンジンが計算した角速度を上書きしてしまうので、useEffect に切り出して変更があったときだけ上書きするのが良いと思います。誤差修正が目的なら、誤差を計算して閾値を超えたときだけこの API を呼ぶようにしてください。

}

// 計算した力を重心に適用
forceAccumulator.multiplyScalar(timeScale);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここはtimeScaleの2乗をかけるのが正しいらしいです。

forceAccumulator.multiplyScalar(timeScale * timeScale);

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 19, 2026

Deploying space-simulator with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1f84ef9
Status: ✅  Deploy successful!
Preview URL: https://8ae0c67c.space-simulator.pages.dev
Branch Preview URL: https://feature-parameters.space-simulator.pages.dev

View logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants